package com.region.integral.business_user.obtain.dao.delegate;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.region.integral.business_user.obtain.dao.IIntegralAuthentication;
import com.region.integral.business_user.obtain.dao.IIntegralCheckYes;
import com.region.integral.business_user.obtain.dao.IIntegralGoodsCommented;
import com.region.integral.business_user.obtain.dao.IIntegralGoodsConfirmed;
import com.region.integral.business_user.obtain.dao.IIntegralReplyConsultting;
import com.region.integral.business_user.obtain.dao.IIntegralSellGoods;
import com.region.integral.common_user.obtain.vo.IntegralData;
import com.region.integral.exception.IntegralException;
@Component("business_obtain_regulationObjectDelegate")
public class RegulationObjectDelegate {
	@Resource(name="iIntegralAuthentication")
	private IIntegralAuthentication iIntegralAuthentication;
	@Resource(name="iIntegralCheckYes")
	private IIntegralCheckYes iIntegralCheckYes;
	@Resource(name="iIntegralGoodsCommented")
	private IIntegralGoodsCommented iIntegralGoodsCommented;
	@Resource(name="iIntegralGoodsConfirmed")
	private IIntegralGoodsConfirmed iIntegralGoodsConfirmed;
	@Resource(name="iIntegralReplyConsultting")
	private IIntegralReplyConsultting iIntegralReplyConsultting;
	@Resource(name="iIntegralSellGoods")
	private IIntegralSellGoods iIntegralSellGoods;
	
	
	public boolean authenticationDelegate(int userid,String authWay){
		IntegralData integralData = new IntegralData();
		try {
			iIntegralAuthentication.authentication(userid, authWay, integralData);
		} catch (IntegralException e) {
			e.printStackTrace();
		}
		return integralData.isSuccee();
	}
	public boolean checkYes(int userid){
		IntegralData integralData = new IntegralData();
		try {
			iIntegralCheckYes.checkYes(userid, integralData);
		} catch (IntegralException e) {
			e.printStackTrace();
		}
		return integralData.isSuccee();
	}
	public boolean goodsCommented(int userid,boolean isbuyer,int goodNum,int badNum){
		IntegralData integralData = new IntegralData();
		try {
			iIntegralGoodsCommented.goodsCommented(userid, isbuyer, goodNum, badNum, integralData);
		} catch (IntegralException e) {
			e.printStackTrace();
		}
		return integralData.isSuccee();
	}
	public boolean goodsConfirmed(int userid,int minute){
		IntegralData integralData = new IntegralData();
		try {
			iIntegralGoodsConfirmed.goodsConfirmed(userid, minute, integralData);
		} catch (IntegralException e) {
			e.printStackTrace();
		}
		return integralData.isSuccee();
	}
	public boolean replyConsultting(int userid){
		IntegralData integralData = new IntegralData();
		try {
			iIntegralReplyConsultting.replyConsultting(userid, integralData);
		} catch (IntegralException e) {
			e.printStackTrace();
		}
		return integralData.isSuccee();
	}
	public boolean sellGoods(int userid,double price){
		IntegralData integralData = new IntegralData();
		try {
			iIntegralSellGoods.sellGoods(userid, price, integralData);
		} catch (IntegralException e) {
			e.printStackTrace();
		}
		return integralData.isSuccee();
	}
}
